<template>
  <div>
    <div class="layout bg-color-ink-green">
      <div :class="[$i18n.locale === 'en' ? 'part1-en' : '', 'part1 layout-container']">
        <div class="part1-text intel-one">{{ $t('welcome.part1text') }}</div>
      </div>
    </div>
    <div class="layout">
      <div class="part2 layout-container" style="position: relative;">
        <img src="../../assets/images/welcome/part2.png" alt=""/>
        <div class="text">
          <div class="title page-title">{{ $t('welcome.part2text.title') }}</div>
          <div class="content">{{ $t('welcome.part2text.desc') }}</div>
        </div>
        <div v-show="!isLogin" class="register-button" @click="handleRegisterButtonClick">{{ $t('welcome.button.registerText') }}</div>
      </div>
    </div>
    <div class="layout bg-color-ink-green">
      <div class="part3 layout-container">
        <video src="https://intelaulinpro.oss-cn-beijing.aliyuncs.com/video/intel-olypic.mp4" controls="controls">
          您的浏览器不支持 video, 请更换为现代浏览器。
        </video>
      </div>
    </div>
    <div class="layout">
      <div class="part4 layout-container">
        <div class="part4-item" v-for="(item,index) in part4images" @click="handlePageNav(index)">
          <img :src="item" alt="">
          <div class="title">{{ $t(`welcome.part4text[${index}].title`) }}</div>
          <div class="desc">{{ $t(`welcome.part4text[${index}].desc`) }}</div>
        </div>
      </div>
    </div>

    <div class="layout">
      <div class="part5 layout-container">
        <div class="focus">
          <div class="text">
            <div class="title page-title">{{ $t('welcome.part5text.focusTitle') }}</div>
            <div class="desc">{{ $t('welcome.part5text.focusDesc') }}</div>
          </div>
        </div>
        <div class="introduction">
          <div class="title page-title">{{ $t('welcome.part5text.introductionTitle') }}</div>
          <div :class="[{'desc-zh': $i18n.locale=='zh'}, 'desc']">{{ $t('welcome.part5text.introductionDesc') }}</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "Welcome",
  data() {
    return {
      part4images: [
        require('../../assets/images/welcome/part4-1.png'),
        require('../../assets/images/welcome/part4-2.png'),
        require('../../assets/images/welcome/part4-3.png'),
        require('../../assets/images/welcome/part4-4.png'),
      ]
    }
  },
  computed: {
    loginShow () {
      return this.$store.state.loginShow
    },
    isLogin () {
      return this.$store.state.isLogin
    }
  },
  methods: {
    handlePageNav(index) {
      const pages = ['itinerary','itinerary','faq','contact']
      this.$router.push({
        path: this.$i18n.path(pages[index])
      })
      if (index === 0) {
        this.$store.commit('SET_MENU_INDEX', 1)
      } else {
        this.$store.commit('SET_MENU_INDEX', index)
      }
    },
    handleRegisterButtonClick () {
      if (process.client) {
        document.body.scrollTop = document.documentElement.scrollTop = 0;
      }
      this.$store.commit('SET_LOGIN_SHOW', true)
    }
  }
}
</script>

<style scoped>
.register-button {
  position: absolute;
  bottom: 55px;
  left: 615px;
  width: 160px;
  height: 48px;
  background: #0068B5;
  color: white;
  text-align: center;
  line-height: 48px;
  font-size: 16px;
  cursor: pointer;
}
.part1 {
  height: 460px;
  background: url("https://intelaulinpro.oss-cn-beijing.aliyuncs.com/Index/part1-zh.png") 50% 50% no-repeat;
  position: relative;
}
.part1-en {
  background: url("https://intelaulinpro.oss-cn-beijing.aliyuncs.com/Index/part1-en.png") 50% 50% no-repeat;
}

.part1 .part1-text {
  width: 416px;
  height: 104px;
  font-size: 40px;
  color: #FFFFFF;
  position: absolute;
  top: 200px;
  left: 40px;
}
.part1-en .part1-text {
  top: 174px;
}
.part2 {
  height: 446px;
  display: flex;
  padding-top: 56px;
}

.part2 img {
  width: 592px;
  height: 334px;
}

.part2 .text {
  padding-top: 20px;
  padding-left: 20px;
}

.part2 .text .title {
  font-weight: bold;
  font-size: 30px;
  color: #333333;
  padding-bottom: 20px;
}

.part2 .text .content {
  font-size: 16px;
  color: #333333;
  line-height: 26px;
}

.part3 {
  height: 552px;
}

.part4 {
  height: 428px;
  display: flex;
  justify-content: space-between;
  padding: 40px 0;
}

.part4-item {
  margin: 0 12px;
}

.part4-item img {
  width: 284px;
  height: 252px;
  cursor: pointer;
}

.part4-item .title {
  font-weight: bold;
  font-size: 16px;
  color: #333333;
  padding: 8px 0;
  cursor: pointer;
}

.part4-item .desc {
  font-size: 16px;
  color: #999999;
  line-height: 1.5;
  cursor: pointer;
}

.part5 {
  display: flex;
  padding-bottom: 40px;
  margin-bottom: 40px;
}

.part5 .focus {
  width: 740px;
  height: 306px;
  background: url("../../assets/images/welcome/part5.png") no-repeat;
  background-size: 740px 306px;
  position: relative;
}

.part5 > .focus > .text {
  position: absolute;
  width: 345px;
  height: 158px;
  top: 74px;
  left: 31px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 15px 20px;
}

.part5 > .focus > .text > .title {
  font-size: 24px;
  color: #FFFFFF;
  padding-bottom: 24px;
}

.part5 > .focus > .text > .desc {
  font-weight: lighter;
  font-size: 16px;
  color: #FFFFFF;
}

.part5 > .introduction {
  width: 430px;
  padding-left: 20px;
  line-height: 26px;
}

.part5 > .introduction > .title {
  font-weight: bold;
  font-size: 30px;
  color: #333333;
  padding-bottom: 16px;
}

.part5 > .introduction > .desc {
  font-size: 16px;
  color: #333333;
  /*line-height: 26px;*/
}

.part5 > .introduction > .desc-zh {
  line-height: 30px;
}
</style>
